﻿<!DOCTYPE html>
<html>
<head>
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta charset="UTF-8">
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<title>太好了</title>
</head>
<body>
	<h1>城市资料</h1>
	<form id="form" onsubmit="return false">
		id: <input name="id" id="id" />, 
		name: <input name="name" id="name" /> 
		<input type="submit" onclick="update();" value="保存" />
	</form>
</body>
</html>
<script src="../../js/jquery.3.2.1.min.js"></script>
<script src="../../js/common.js?_=Math.random();"></script>
<script>
	function update() {
		var formdata = $("#form").serializeObject();
		$.ajax({
			type : 'post',
			url : '/city/add',
			contentType : "application/json; charset=utf-8",
			data : JSON.stringify(formdata),
			success : function(data) {
				alert(JSON.stringify(data));
				location.href = 'admin.html';
			},
			error : function(e) {
				alert('系统异常：' + JSON.stringify(e));
			}
		});
	}
</script>

































